/* eslint-disable */
const bodyParser = require('body-parser')
const { list } = require('./mock')

module.exports = (app) => {
	app.use(bodyParser.json())
	app.get('/api/list', (req, res) => res.send({ code: 200, data: list }))

	app.post('/api/detail', (req, res) => {
		const { id } = req.body;
		const item = list.find(item => item.id === id)
		res.send({
			code: 200,
			data: item
		})
	})
}